import { useConfigData } from '@/stores/config-data'
import { storeToRefs } from 'pinia'
const ENV_CONFIG: any = {
  'win': {
    BASE_URL: 'http://client-dwjxz-api.fanqiexitong.net',
    PRODUCTION_NAME:'下载大师',
    DEFAULT_PATH_NAME: 'download-master',
    type:'win'
  },
  'warcraft': {
    BASE_URL: 'https://client-warcraft-api.gamebigfile.com',
    PRODUCTION_NAME:'魔兽下载器',
    DEFAULT_PATH_NAME: 'download-warcraft',
    type:'warcraft'
  },
  'redAlert': {
    BASE_URL: 'https://client-warcraft-api.gamebigfile.com',
    PRODUCTION_NAME:'红色警戒',
    DEFAULT_PATH_NAME: 'download-redAlert',
    type:'redAlert'
  },
  'pvz': {
    BASE_URL: 'https://client-warcraft-api.gamebigfile.com',
    PRODUCTION_NAME:'植物大战僵尸',
    DEFAULT_PATH_NAME: 'download-pvz',
    type:'pvz'
  },
  'cs': {
    BASE_URL: 'https://client-warcraft-api.gamebigfile.com',
    PRODUCTION_NAME:'反恐精英',
    DEFAULT_PATH_NAME: 'download-cs',
    type:'cs'
  },
  'spiderPaper': {
    BASE_URL: 'https://client-warcraft-api.gamebigfile.com',
    PRODUCTION_NAME:'蜘蛛纸牌',
    DEFAULT_PATH_NAME: 'download-spiderPaper',
    type:'spiderPaper'
  }
}
interface IConfig {
  [key: number | string]: string
}
const configByAppid:IConfig = {
  164: 'win',
  165: 'warcraft',
  166: 'redAlert',
  167: 'cs',
  168: 'pvz',
  169: 'spiderPaper'
}
export const useEnvConfig = () => {
  const configDataStore = useConfigData()
  const { configData } = storeToRefs(configDataStore)
  const curType = configByAppid[configData.value.app_id] || 'warcraft'
  return {
    ENV_CONFIG: ENV_CONFIG[curType]
  }
}